<!DOCTYPE html>
<html class="x-admin-sm">
{include file="common/static" /}
    <body>
        <div class="layui-fluid">
            <div class="layui-row">
                <form class="layui-form">
                  <div class="layui-form-item">
                      <label for="username" class="layui-form-label">
                          <span class="x-red">*</span>会员名称
                      </label>
                      <div class="layui-input-inline">
                          <input type="text" id="name" name="username" required="" lay-verify="required"
                          autocomplete="off" class="layui-input" value="{$list.vipname}">
                      </div>

                  </div>
                    <div class="layui-form-item">
                        <label for="username" class="layui-form-label">
                            <span class="x-red">*</span>会员折扣</label>
                        <div class="layui-input-inline">
                            <select name="shipping" class="valid" id="price">
                                <option value="{$list.price}">
                                    {if $list.price == '0.9'}9折
                                    {elseif $list.price == '0.8' /}8折
                                    {elseif $list.price == '0.7' /}7折
                                    {elseif $list.price == '0.6' /}6折
                                    {elseif $list.price == '0.5' /}5折
                                    {elseif $list.price == '0.4' /}4折
                                    {else /}3折
                                    {/if}
                                </option>
                                <option value="0.9">9折</option>
                                <option value="0.8">8折</option>
                                <option value="0.7">7折</option>
                                <option value="0.6">6折</option>
                                <option value="0.5">5折</option>
                                <option value="0.4">4折</option>
                                <option value="0.3">3折</option>
                            </select>
                        </div>
                    </div>
                  <div class="layui-form-item">
                      <label for="L_repass" class="layui-form-label">
                      </label>
                      <button  class="layui-btn" type="button" onclick="edits()">
                          增加
                      </button>
                  </div>
              </form>
            </div>
        </div>

    </body>
<script>
    layui.use(['form', 'layer'],
            function() {
                $ = layui.jquery;
                var form = layui.form,
                        layer = layui.layer;
            });
    function edits(){
        $.ajax({
            type:"post",
            url: "{:url('home/member/vipedits')}",
            data: {
                id:{$list.id},
                price:$('#price').val(),
                vipname:$('#name').val()
            },
            success: function(data){
                console.log(data);
                toastr.error(data.msg);
                if(data.code == 100){
                    setTimeout(function () {
                        layer.closeAll();
                        parent.location.reload();
                    },1500);
                }
            }});
    }
</script>

</html>
